{extend name="base" /}
{block name="content"}
<ol class="breadcrumb" style="background-color: #f9f9f9;padding:8px 0;margin-bottom:10px;">
    <li>
        <a href=""><i class="fa fa-cogs"></i>
            文章管理</a>
    </li>
    <li class="active">
        <a href="{:url('admin/article/recycle')}">回收站</a>
    </li>
</ol>
<ul class="nav nav-tabs" role="tablist">
    <li class="active"><a href="#tab1">文章管理</a></li>
    <li><a href="javascript:void(0);">回收站</a></li>
</ul>
<form action="" method="post">
    <div class="panel panel-default">
        <div class="panel-body">
            <table class="table table-hover">
                <thead>
                <tr>
                    <th width="5%">编号</th>
                    <th>文章名称</th>
                    <th>文章作者</th>
                    <th width="5%">排序</th>
                    <th>所属分类</th>
                    <th>添加时间</th>
                    <th width="200">操作</th>
                </tr>
                </thead>
                <tbody>
                {foreach name="list" item = "v"}
                <tr>
                    <td>{$v['arc_id']}</td>
                    <td>{$v['arc_title']}</td>
                    <td>{$v['arc_author']}</td>
                    <td>
                        <input type="text" id="sort" value="{$v['arc_sort']}" class="form-control" oldvalue="{$v['arc_sort']}" onblur="changessort(this,{$v['arc_id']})">
                    </td>
                    <td>{$v['cate_name']}</td>
                    <td>{:date('Y-m-d H:i:s',$v['sendtime'])}</td>
                    <td>
                        <div class="btn-group">
                            <button data-toggle="dropdown" class="btn btn-primary btn-xs dropdown-toggle">操作 <span class="caret"></span></button>
                            <ul class="dropdown-menu dropdown-menu-right">
                                <li><a onclick="recovery({$v['arc_id']})"}" href="javascript:void(0);" >恢复数据</a></li>
                                <li class="divider"></li>
                                <li><a href="javascript:void(0);" onclick="del({$v['arc_id']});">删除</a></li>
                            </ul>
                        </div>
                    </td>
                </tr>
                {/foreach}
                </tbody>
            </table>
        </div>
    </div>
</form>
<div class="pagination pagination-sm pull-right">
    {$list->render()}
</div>
<script type="text/javascript">
    function changessort(obj,arc_id) {
        var sort = $(obj).val();
        var oldsort = $("#sort").attr("oldvalue");
        if (sort != oldsort) {
            $.post("{:url('updatesort')}", {arc_sort: sort, arc_id: arc_id}, function (result) {
                if (result['code'] == 0) {
                    util.message(result['msg'], "back", "error");
                } else {
                    util.message(result['msg'], "refresh", "success");
                }
            }, 'json');
        }
    }
    function del(arc_id) {
        util.confirm("您确定要删除该条内容吗？",function () {
            location.href="{:url('del')}"+"?arc_id="+arc_id;
        })
    }

    function recovery(arc_id) {
        util.confirm("您确定恢复当前这条数据吗？",function () {
            location.href="{:url('recovery')}"+"?arc_id="+arc_id;
        })
    }
</script>
{/block}